<!DOCTYPE html>



  


<html class="theme-next muse use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">












<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />






















<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=6.0.4" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=6.0.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=6.0.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon.ico?v=6.0.4">


  <link rel="mask-icon" href="/images/logo.svg?v=6.0.4" color="#222">









<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Muse',
    version: '6.0.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":true,"onmobile":false},
    fancybox: false,
    fastclick: false,
    lazyload: false,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>


  




  
  <meta name="keywords" content="JavaScript," />


<meta name="description" content="根据表格高度显示滚动条 页面载入后根据表格高度判断是否需要滚动条，增加滚动条的同时还要增加一个按钮可以显示表格的完整高度，再次点击按钮变回带滚动条的部分显示方式">
<meta name="keywords" content="JavaScript">
<meta property="og:type" content="article">
<meta property="og:title" content="根据内容高度显示滚动条">
<meta property="og:url" content="http://yoursite.com/2017/07/19/js/JavaScript-008/index.html">
<meta property="og:site_name" content="Kamui&#39;s Notes">
<meta property="og:description" content="根据表格高度显示滚动条 页面载入后根据表格高度判断是否需要滚动条，增加滚动条的同时还要增加一个按钮可以显示表格的完整高度，再次点击按钮变回带滚动条的部分显示方式">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2018-02-28T03:43:14.699Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="根据内容高度显示滚动条">
<meta name="twitter:description" content="根据表格高度显示滚动条 页面载入后根据表格高度判断是否需要滚动条，增加滚动条的同时还要增加一个按钮可以显示表格的完整高度，再次点击按钮变回带滚动条的部分显示方式">



  <link rel="alternate" href="/atom.xml" title="Kamui's Notes" type="application/atom+xml" />




  <link rel="canonical" href="http://yoursite.com/2017/07/19/js/JavaScript-008/"/>



<script type="text/javascript" id="page.configurations">
  CONFIG.page = {
    sidebar: "",
  };
</script>
  <title>根据内容高度显示滚动条 | Kamui's Notes</title>
  









  <noscript>
  <style type="text/css">
    .use-motion .motion-element,
    .use-motion .brand,
    .use-motion .menu-item,
    .sidebar-inner,
    .use-motion .post-block,
    .use-motion .pagination,
    .use-motion .comments,
    .use-motion .post-header,
    .use-motion .post-body,
    .use-motion .collection-title { opacity: initial; }

    .use-motion .logo,
    .use-motion .site-title,
    .use-motion .site-subtitle {
      opacity: initial;
      top: initial;
    }

    .use-motion {
      .logo-line-before i { left: initial; }
      .logo-line-after i { right: initial; }
    }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"> <div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Kamui's Notes</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            <i class="menu-item-icon fa fa-fw fa-home"></i> <br />首页</a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags/" rel="section">
            <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />标签</a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            <i class="menu-item-icon fa fa-fw fa-th"></i> <br />分类</a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />归档</a>
        </li>
      
        
        <li class="menu-item menu-item-project">
          <a href="/project/" rel="section">
            <i class="menu-item-icon fa fa-fw fa-diamond"></i> <br />项目</a>
        </li>
      
        
        <li class="menu-item menu-item-demo">
          <a href="/demo/" rel="section">
            <i class="menu-item-icon fa fa-fw fa-rocket"></i> <br />演示</a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about/" rel="section">
            <i class="menu-item-icon fa fa-fw fa-user"></i> <br />关于</a>
        </li>
      

      
    </ul>
  

  
</nav>


  



 </div>
    </header>

    


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2017/07/19/js/JavaScript-008/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Kamui">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar.png">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Kamui's Notes">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">根据内容高度显示滚动条</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-07-19T16:19:19+08:00">2017-07-19</time>
            

            
            

            
          </span>

          

          
            
          

          
          

          
            <span class="post-meta-divider">|</span>
            <span class="post-meta-item-icon"
            >
            <i class="fa fa-eye"></i>
             阅读次数： 
            <span class="busuanzi-value" id="busuanzi_value_page_pv" ></span>
            </span>
          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>根据表格高度显示滚动条</p>
<p>页面载入后根据表格高度判断是否需要滚动条，增加滚动条的同时还要增加一个按钮可以显示表格的完整高度，再次点击按钮变回带滚动条的部分显示方式</p>
<a id="more"></a>
<p><em>代码如下：</em></p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/***</span></span><br><span class="line"><span class="comment"> ** Created by Kamui on 2017/7/18.</span></span><br><span class="line"><span class="comment"> *  table显示，隐藏，滚动</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line">    <span class="built_in">window</span>.onload = <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;</span><br><span class="line">        <span class="keyword">var</span> module_showTable = (<span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;</span><br><span class="line">            <span class="keyword">var</span> _getTableList = <span class="built_in">document</span>.getElementById(<span class="string">"list-table"</span>);</span><br><span class="line">            <span class="keyword">var</span> _getBtn = <span class="built_in">document</span>.getElementById(<span class="string">"tableBtn"</span>);</span><br><span class="line">            <span class="keyword">var</span> height = _getTableList.offsetHeight;</span><br><span class="line">            <span class="comment">//console.log(height);</span></span><br><span class="line">            <span class="keyword">var</span> onload = <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;</span><br><span class="line">                <span class="keyword">if</span>(height &lt; <span class="number">262</span>)&#123;</span><br><span class="line">                    _getBtn.style.display = <span class="string">"none"</span>;</span><br><span class="line">                    _getTableList.style.overflowY =<span class="string">"visible"</span>;</span><br><span class="line">                &#125;<span class="keyword">else</span> &#123;</span><br><span class="line">                    _getBtn.style.display = <span class="string">"block"</span>;</span><br><span class="line">                    _getTableList.style.height = <span class="string">"232px"</span>;</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;;</span><br><span class="line">            <span class="keyword">var</span> changeHeight = <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;</span><br><span class="line">                <span class="keyword">if</span>(_getTableList.style.height==<span class="string">"auto"</span>)&#123;</span><br><span class="line">	                _getTableList.style.height =<span class="string">"232px"</span>;</span><br><span class="line">	                _getTableList.style.overflowY =<span class="string">"scroll"</span>;</span><br><span class="line">	                _getBtn.innerHTML = <span class="string">"点击展开"</span>;</span><br><span class="line">	                _getBtn.style.backgroundImage =<span class="string">"url(../images/table_btn.png)"</span>;</span><br><span class="line">            	&#125;<span class="keyword">else</span> &#123;</span><br><span class="line">	                _getTableList.style.height=<span class="string">"auto"</span>;</span><br><span class="line">	                _getTableList.style.overflowY =<span class="string">"visible"</span>;</span><br><span class="line">	                _getBtn.innerHTML = <span class="string">"点击收起"</span>;</span><br><span class="line">	                _getBtn.style.backgroundImage =<span class="string">"url(../images/table_btn_.png)"</span>;</span><br><span class="line">            	&#125;</span><br><span class="line">            &#125;;</span><br><span class="line">            <span class="keyword">var</span> addlistener = <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;</span><br><span class="line">                <span class="comment">//console.log( _getBtn);</span></span><br><span class="line">                _getBtn.onclick= <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;</span><br><span class="line">                    changeHeight();</span><br><span class="line">                &#125;;</span><br><span class="line">            &#125;;</span><br><span class="line">            <span class="keyword">return</span>&#123;</span><br><span class="line">                onload:onload,</span><br><span class="line">                addlistener:addlistener,</span><br><span class="line">                changeHeight:changeHeight</span><br><span class="line">            &#125;;</span><br><span class="line">        &#125;)();</span><br><span class="line">        <span class="keyword">var</span> showTable = module_showTable;</span><br><span class="line">        showTable.onload();</span><br><span class="line">        showTable.addlistener();</span><br><span class="line">    &#125;</span><br></pre></td></tr></table></figure>
<p><em>Demo如下：</em><br>在demo中做了一些改动，内容部分由表格变成了文字；<br>增加了一个<code>textarea</code>一个<code>button</code>用于插入文字，插入后为清空内容；<br>在<code>textarea</code>中输入文字，点击插入按钮后会先判断内容高度是否超过<b>设定高度</b>，未超过显示完整内容，超过<b>设定高度</b>会显示滚动条，可用内容上部的按钮显示全部内容</p>
<p><div class="list-title"><textarea style="display:block;width:220px;margin-right: 5px;" id="text" name="i"></textarea><button style="margin-right:5px;margin-top:5px;" class="btn" id="insert">插入文字并显示</button></div></p>
<p><div id="text-wrap" style="display: none;width: 200px;height: auto;"><a id="tableBtn" href="javascript:void(0);" class="btn" target="_blank" rel="noopener">点击展开</a><p id="text-cont" style="border:1px solid #cccccc;overflow-y: scroll; word-break:break-all;height: auto;padding: 5px;">这里是填充文字</p></div></p>
<script>
    /***
     ** Created by Kamui on 2017/7/18.
     *  内容显示，隐藏，滚动
     */
    window.onload = function () {
        var module_showTable = (function () {
            var _getTableList = document.getElementById("text-cont");
            var _getBtn = document.getElementById("tableBtn");

            var onload = function (height) {
                //console.log(height);
                if(height < 132){
                    _getBtn.style.display = "none";
                    _getTableList.style.overflowY ="visible";
                    _getTableList.style.height = "auto";
                }else {
                    _getBtn.style.display = "block";
                    _getTableList.style.height = "132px";
                    _getTableList.style.overflowY ="scroll";
                }
            };
            var changeHeight = function () {
                if(_getTableList.style.height==="auto"){
                    _getTableList.style.height ="132px";
                    _getTableList.style.overflowY ="scroll";
                    _getBtn.innerHTML = "点击展开";
                    //_getBtn.style.backgroundImage ="url(../images/table_btn.png)";
                }else {
                    _getTableList.style.height="auto";
                    _getTableList.style.overflowY ="visible";
                    _getBtn.innerHTML = "点击收起";
                    //_getBtn.style.backgroundImage ="url(../images/table_btn_.png)";
                }
            };
            var addlistener = function () {
                //console.log( _getBtn);
                _getBtn.onclick= function () {
                    changeHeight();
                };
            };
            return{
                onload:onload,
                addlistener:addlistener,
                changeHeight:changeHeight
            };
        })();

        function insert() {
            var insert_btn = document.getElementById("insert");
            var textarea = document.getElementById("text");
            var text_cont = document.getElementById("text-cont");
            var text_wrap = document.getElementById("text-wrap");
                insert_btn.onclick= function () {
                    if(insert_btn.innerHTML === "插入文字并显示") {
                        text_cont.innerHTML = text.value;
                        text_wrap.style.display = "block";
                        insert_btn.innerHTML = "清空文字重新输入";
                        var height = document.getElementById("text-cont").offsetHeight;
                        var showTable = module_showTable;
                        showTable.onload(height);
                        showTable.addlistener();
                    }else {
                        insert_btn.innerHTML = "插入文字并显示";
                        textarea.value = "";
                        text_wrap.style.display = "none";
                        text_cont.innerHTML = "";
                        text_cont.style.height="auto"
                    }

                };
        }

        insert();
    }
</script>

<p><em>代码如下：</em></p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/***</span></span><br><span class="line"><span class="comment"> ** Created by Kamui on 2017/7/18.</span></span><br><span class="line"><span class="comment"> *  内容显示，隐藏，滚动</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line">   <span class="built_in">window</span>.onload = <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;</span><br><span class="line">       <span class="keyword">var</span> module_showTable = (<span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;</span><br><span class="line">           <span class="keyword">var</span> _getTableList = <span class="built_in">document</span>.getElementById(<span class="string">"text-cont"</span>);</span><br><span class="line">           <span class="keyword">var</span> _getBtn = <span class="built_in">document</span>.getElementById(<span class="string">"tableBtn"</span>);</span><br><span class="line"></span><br><span class="line">           <span class="keyword">var</span> onload = <span class="function"><span class="keyword">function</span> (<span class="params">height</span>) </span>&#123;</span><br><span class="line">               <span class="comment">//console.log(height);</span></span><br><span class="line">               <span class="keyword">if</span>(height &lt; <span class="number">132</span>)&#123;</span><br><span class="line">                   _getBtn.style.display = <span class="string">"none"</span>;</span><br><span class="line">                   _getTableList.style.overflowY =<span class="string">"visible"</span>;</span><br><span class="line">                   _getTableList.style.height = <span class="string">"auto"</span>;</span><br><span class="line">               &#125;<span class="keyword">else</span> &#123;</span><br><span class="line">                   _getBtn.style.display = <span class="string">"block"</span>;</span><br><span class="line">                   _getTableList.style.height = <span class="string">"132px"</span>;</span><br><span class="line">                   _getTableList.style.overflowY =<span class="string">"scroll"</span>;</span><br><span class="line">               &#125;</span><br><span class="line">           &#125;;</span><br><span class="line">           <span class="keyword">var</span> changeHeight = <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;</span><br><span class="line">               <span class="keyword">if</span>(_getTableList.style.height===<span class="string">"auto"</span>)&#123;</span><br><span class="line">                   _getTableList.style.height =<span class="string">"132px"</span>;</span><br><span class="line">                   _getTableList.style.overflowY =<span class="string">"scroll"</span>;</span><br><span class="line">                   _getBtn.innerHTML = <span class="string">"点击展开"</span>;</span><br><span class="line">                   <span class="comment">//_getBtn.style.backgroundImage ="url(../images/table_btn.png)";</span></span><br><span class="line">               &#125;<span class="keyword">else</span> &#123;</span><br><span class="line">                   _getTableList.style.height=<span class="string">"auto"</span>;</span><br><span class="line">                   _getTableList.style.overflowY =<span class="string">"visible"</span>;</span><br><span class="line">                   _getBtn.innerHTML = <span class="string">"点击收起"</span>;</span><br><span class="line">                   <span class="comment">//_getBtn.style.backgroundImage ="url(../images/table_btn_.png)";</span></span><br><span class="line">               &#125;</span><br><span class="line">           &#125;;</span><br><span class="line">           <span class="keyword">var</span> addlistener = <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;</span><br><span class="line">               <span class="comment">//console.log( _getBtn);</span></span><br><span class="line">               _getBtn.onclick= <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;</span><br><span class="line">                   changeHeight();</span><br><span class="line">               &#125;;</span><br><span class="line">           &#125;;</span><br><span class="line">           <span class="keyword">return</span>&#123;</span><br><span class="line">               onload:onload,</span><br><span class="line">               addlistener:addlistener,</span><br><span class="line">               changeHeight:changeHeight</span><br><span class="line">           &#125;;</span><br><span class="line">       &#125;)();</span><br><span class="line"></span><br><span class="line">       <span class="function"><span class="keyword">function</span> <span class="title">insert</span>(<span class="params"></span>) </span>&#123;</span><br><span class="line">           <span class="keyword">var</span> insert_btn = <span class="built_in">document</span>.getElementById(<span class="string">"insert"</span>);</span><br><span class="line">           <span class="keyword">var</span> textarea = <span class="built_in">document</span>.getElementById(<span class="string">"text"</span>);</span><br><span class="line">           <span class="keyword">var</span> text_cont = <span class="built_in">document</span>.getElementById(<span class="string">"text-cont"</span>);</span><br><span class="line">           <span class="keyword">var</span> text_wrap = <span class="built_in">document</span>.getElementById(<span class="string">"text-wrap"</span>);</span><br><span class="line">               insert_btn.onclick= <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;</span><br><span class="line">                   <span class="keyword">if</span>(insert_btn.innerHTML === <span class="string">"插入文字并显示"</span>) &#123;</span><br><span class="line">                       text_cont.innerHTML = text.value;</span><br><span class="line">                       text_wrap.style.display = <span class="string">"block"</span>;</span><br><span class="line">                       insert_btn.innerHTML = <span class="string">"清空文字重新输入"</span>;</span><br><span class="line">                       <span class="keyword">var</span> height = <span class="built_in">document</span>.getElementById(<span class="string">"text-cont"</span>).offsetHeight;</span><br><span class="line">                       <span class="keyword">var</span> showTable = module_showTable;</span><br><span class="line">                       showTable.onload(height);</span><br><span class="line">                       showTable.addlistener();</span><br><span class="line">                   &#125;<span class="keyword">else</span> &#123;</span><br><span class="line">                       insert_btn.innerHTML = <span class="string">"插入文字并显示"</span>;</span><br><span class="line">                       textarea.value = <span class="string">""</span>;</span><br><span class="line">                       text_wrap.style.display = <span class="string">"none"</span>;</span><br><span class="line">                       text_cont.innerHTML = <span class="string">""</span>;</span><br><span class="line">                       text_cont.style.height=<span class="string">"auto"</span></span><br><span class="line">                   &#125;</span><br><span class="line"></span><br><span class="line">               &#125;;</span><br><span class="line">       &#125;</span><br><span class="line">       insert();</span><br><span class="line">   &#125;</span><br></pre></td></tr></table></figure>
      
    </div>

    

    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/JavaScript/" rel="tag"># JavaScript</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/07/13/ife2017/js/Task06/" rel="next" title="IFE JavaScript Task 1-06">
                <i class="fa fa-chevron-left"></i> IFE JavaScript Task 1-06
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/07/26/JS-Sorting/JS-Sorting/" rel="prev" title="十大经典排序算法">
                十大经典排序算法 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      

      <section class="site-overview-wrap sidebar-panel sidebar-panel-active">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image"
                src="/images/avatar.png"
                alt="Kamui" />
            
              <p class="site-author-name" itemprop="name">Kamui</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          
            <nav class="site-state motion-element">
              
                <div class="site-state-item site-state-posts">
                
                  <a href="/archives/">
                
                    <span class="site-state-item-count">58</span>
                    <span class="site-state-item-name">日志</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-categories">
                  <a href="/categories/index.html">
                    
                    
                      
                    
                    <span class="site-state-item-count">1</span>
                    <span class="site-state-item-name">分类</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-tags">
                  <a href="/tags/index.html">
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">16</span>
                    <span class="site-state-item-name">标签</span>
                  </a>
                </div>
              
            </nav>
          

          
            <div class="feed-link motion-element">
              <a href="/atom.xml" rel="alternate">
                <i class="fa fa-rss"></i>
                RSS
              </a>
            </div>
          

          
            <div class="links-of-author motion-element">
              
                <span class="links-of-author-item">
                  <a href="https://github.com/kamui1073" target="_blank" title="GitHub"><i class="fa fa-fw fa-github"></i>GitHub</a>
                  
                </span>
              
            </div>
          

          
          

          
          

          
            
          
          

        </div>
      </section>

      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2019</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Kamui</span>

  

  
</div>




  <div class="powered-by">Hosted by <a href='https://coding.net/help/doc/pages/index.html' style='font-weight:bold;' target='_blank'>Coding Pages</a></div>


<span class="post-meta-divider">|</span>


  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 <a class="theme-link" target="_blank" href="https://github.com/theme-next/hexo-theme-next">NexT.Muse</a> v6.0.4</div>




        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="site-uv" title="总访客量">
      <i class="fa fa-user"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
    </span>
  
  <span class="post-meta-divider"></span>
  
    <span class="site-pv" title="总访问量">
      <i class="fa fa-spin fa-globe"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
    </span>
  
</div>









        
      </div>
    </footer>

    

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
          <span id="scrollpercent"><span>0</span>%</span>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>


























  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=6.0.4"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=6.0.4"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=6.0.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=6.0.4"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=6.0.4"></script>




  


  <script type="text/javascript" src="/js/src/love.js?v=6.0.4"></script>

  <script type="text/javascript" src="/js/src/console-log.js?v=6.0.4"></script>




  



	





  





  










  





  

  

  

  

  
  

  

  

  

  



  



</body>
</html>
